<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:composite="http://java.sun.com/jsf/composite"
	xmlns:common="http://java.sun.com/jsf/composite/common">

<composite:interface>
	<composite:attribute name="maquina" />
	<composite:attribute name="readOnly" default="false" />
</composite:interface>

<composite:implementation>
	<!-- MAQUINA -->
	<div id="#{cc.id}">
		<p:panelGrid>
			<p:row>
				<p:column>
					<h:outputLabel for="codigo" value="Codigo" />
				</p:column>
				<p:column>
					<p:inputText id="codigo" maxlength="10"
						value="#{cc.attributes.maquina.maqCodigo}"
						readonly="#{cc.attributes.readOnly}" label="Codigo"
						required="true" />
				</p:column>
				<p:column>
					<p:message showDetail="false" rendered="#{!cc.attributes.readOnly}"
						id="codigo_message" for="codigo" />
				</p:column>
				<p:column>
					<p:outputLabel value="Tipo"></p:outputLabel>
				</p:column>
				<p:column>
					<p:selectOneMenu id="tipos"
						value="#{cc.attributes.maquina.maqTipo}">
						<f:selectItems value="#{maqMB.maquinaTipos}" var="maquinaTipo"
							itemLabel="#{maquinaTipo.nombre}"
							itemValue="#{maquinaTipo.valor}" />
					</p:selectOneMenu>
				</p:column>
				<p:column>
				</p:column>
			</p:row>
		</p:panelGrid>
		<p:panelGrid>
			<p:row>
				<p:column>
					<h:outputLabel for="maquinaDescription" value="Descripcion"></h:outputLabel>
					<p:inputTextarea id="maquinaDescription"
						value="#{cc.attributes.maquina.description}" rows="2"
						counter="counter" maxlength="150" cols="150"
						counterTemplate="{0} caracteres restantes." style="width: 100%;"
						required="true" readonly="#{cc.attributes.readOnly}" />
					<h:outputText id="counter" style="margin-bottom:10px;"
						rendered="#{!cc.attributes.readOnly}" />
					<p:message showDetail="false" rendered="#{!cc.attributes.readOnly}"
						id="description_message" for="maquinaDescription" />
				</p:column>
			</p:row>
		</p:panelGrid>
	</div>

</composite:implementation>

</html>